

*negative changes by at least 0.05 on V-Dem's liberal democracy index v2x_libdem

clear 
*cd "C:\Users\bimal.adhikari\Dropbox\Research 2023\2022 AKM - My Part\Earlier Files\Data Analysis"
cd "C:\Users\murdie\Dropbox\2022 Adhikari King and Murdie\Democratic Backsliding Paper\Data Analysis"

use WorkingDataset.dta, replace 
do "Analysis Do File 2023.do"

log using rnr_robustness_updated, replace


tsset ccode year
gen libdem_drop = .
replace libdem_drop = 0 if ((v2x_libdem -l.v2x_libdem)>=-0.05) & v2x_libdem!=. & v2x_libdem!=.
replace libdem_drop = 1 if ((v2x_libdem -l.v2x_libdem)<-0.05) & v2x_libdem!=. & v2x_libdem!=.

reg theta_mean l.theta_mean  libdem_drop l.v2x_libdem l.lnwdi_pop l.lnwdi_gdpcapcon2015 l.intllocation l.civillocation, robust
outreg2 using TableRR ,  replace word se label



*negative changes by at least 0.05 on V-Dem's participatory democracy index v2x_partipdem
 

tsset ccode year
gen partip_drop = .
replace partip_drop = 0 if ((v2x_partipdem -l.v2x_partipdem)>=-0.05) & v2x_partipdem!=. & v2x_partipdem!=.
replace partip_drop = 1 if ((v2x_partipdem -l.v2x_partipdem)<-0.05) & v2x_partipdem!=. & v2x_partipdem!=.

reg theta_mean l.theta_mean  partip_drop l.v2x_partipdem l.lnwdi_pop l.lnwdi_gdpcapcon2015 l.intllocation l.civillocation, robust
outreg2 using TableRR ,  append word se label



*negative changes by at least 0.05 on V-Dem's deliberative democracy index index v2x_delibdem



tsset ccode year
gen delib_drop = .
replace delib_drop = 0 if ((v2x_delibdem -l.v2x_delibdem)>=-0.05) & v2x_delibdem!=. & v2x_delibdem!=.
replace delib_drop = 1 if ((v2x_delibdem -l.v2x_delibdem)<-0.05) & v2x_delibdem!=. & v2x_delibdem!=.

reg theta_mean l.theta_mean delib_drop l.v2x_delibdem  l.lnwdi_pop l.lnwdi_gdpcapcon2015 l.intllocation l.civillocation, robust
outreg2 using TableRR ,  append word se label



*negative changes by at least 0.05 on V-Dem's egalitarian democracy index v2x_egaldem

tsset ccode year
gen egal_drop = .
replace egal_drop = 0 if ((v2x_egaldem -l.v2x_egaldem)>=-0.05) & v2x_egaldem!=. & v2x_egaldem!=.
replace egal_drop = 1 if ((v2x_egaldem -l.v2x_egaldem)<-0.05) & v2x_egaldem!=. & v2x_egaldem!=.

reg theta_mean l.theta_mean egal_drop  l.v2x_egaldem  l.lnwdi_pop l.lnwdi_gdpcapcon2015 l.intllocation l.civillocation, robust
outreg2 using TableRR ,  append word se label



*Murdie note: all of these prior didn't include lagged control variables - needed to change that 

*Add by Murdie 10/2/2023

*define democratic backsliding as a country that was a democracy by chga_demo standards and then switched

generate chga_demobacksliding = 1 if chga_demo==0 & l.chga_demo==1
count if chga_demobacksliding==1
replace chga_demobacksliding =0 if chga_demobacksliding!=1 & chga_demo!=. & l.chga_demo!=.

reg theta_mean l.theta_mean  chga_demob l.chga_demo l.lnwdi_pop l.lnwdi_gdpcapcon2015 l.intllocation l.civillocation, robust
outreg2 using TableRR ,  append word se label


tab chga_demob if e(sample)
*49 cases 

*Now, some sort of correlation 

mkcorr theta_mean physint PTS_A  polity2 v2x_polyarchy v2x_egaldem v2x_delibdem v2x_partipdem  v2x_libdem chga_demo , log(pwRR) lab replace casewise


save workingdatasetRR.dta, replace

import delimited "C:\Users\murdie\Dropbox\2022 Adhikari King and Murdie\Democratic Backsliding Paper\Data Analysis\xpolity.csv", clear 

keep ccode year xpolity
merge 1:1 ccode year using "C:\Users\murdie\Dropbox\2022 Adhikari King and Murdie\Democratic Backsliding Paper\Data Analysis\workingdatasetRR.dta", nogenerate
tsset ccode year
replace xpolity=. if xpolity<=-66
gen AnyNegativeXPolity = .
replace AnyNegativeXPolity = 0 if xpolity >= l.xpolity & xpolity!=. & l.xpolity!=.
replace AnyNegativeXPolity = 1 if xpolity < l.xpolity & xpolity!=. & l.xpolity!=.

reg theta_mean l.theta_mean AnyNegativeXPolity l.xpolity l.lnwdi_pop l.lnwdi_gdpcapcon2015 l.intllocation l.civillocation, robust
outreg2 using TableRR ,  append word se label

mkcorr theta_mean physint PTS_A  polity2 xpolity v2x_polyarchy v2x_egaldem v2x_delibdem v2x_partipdem  v2x_libdem chga_demo , log(pwRR) lab replace casewise
